package com.naiterui.ehp.bs.payment.entity;

import static javax.persistence.GenerationType.IDENTITY;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Version;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * <pre>
 * 支付信息表
 * </pre>
 *
 * @date 2017年09月09日
 * @since 1.0.0
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
@Entity
@Table(name = "service_pay_info")
public class PayInfo implements Serializable {

    /**
     * The constant serialVersionUID.
     */
    private static final long serialVersionUID = 3092363033330882903L;

    /**
     * The Id.
     */
    @Id
    @GeneratedValue(strategy = IDENTITY)
    @Column(name = "id", unique = true, nullable = false)
    private Long id;
    /**
     * 业务订单号
     */
    @Column(name = "order_sn", nullable = false)
    private String orderSn;
    /**
     * 支付单号
     */
    @Column(name = "trade_sn")
    private String tradeSn;
    /**
     * 上游系统交易单号
     */
    @Column(name = "channel_trade_sn")
    private String channelTradeSn;
    /**
     * 订单平台
     */
    @Column(name = "origin")
    private Integer origin;
    /**
     * 渠道类型 1：微信 2：支付宝
     */
    @Column(name = "channel_type")
    private Integer channelType;
    /**
     * 业务类型 1：个性自定义收费 2：图文咨询收费 3：打赏 4：视频
     */
    @Column(name = "type")
    private Integer type;
    /**
     * 回调业务系统地址
     */
    @Column(name = "notify_business_url", nullable = false)
    private String notifyBusinessUrl;
    /**
     * 业务通知状态（0：待通知 1：通知成功 2：通知失败）
     */
    @Column(name = "notify_business_status", nullable = false)
    private Integer notifyBusinessStatus;
    /**
     * 产品价格
     */
    @Column(name = "price", nullable = false)
    private Long price;
    /**
     * 用户标示
     */
    @Column(name = "user_id", nullable = false)
    private String userId;
    /**
     * 商品名称
     */
    @Column(name = "product_name")
    private String productName;
    /**
     * 订单状态
     * 1：支付
     * 2：已支付
     * 3：支付失败
     * 4：支付中
     * 5：订单已关闭
     * 6：系统已退款
     * 默认1
     */
    @Column(name = "status", nullable = false)
    private Integer status;
    /**
     * 交易完成时间
     */
    @Column(name = "pay_time")
    private Date payTime;
    /**
     * 失败原因
     */
    @Column(name = "fail_msg")
    private String failMsg;
    /**
     * 查询的支付状态，1：已支付， 2：支付失败
     */
    @Column(name = "query_status")
    private Integer queryStatus;
    /**
     * 查询错误原因
     */
    @Column(name = "query_fail_msg")
    private String queryFailMsg;
    /**
     * 创建时间
     */
    @Column(name = "created_at")
    private Date createdAt;
    /**
     * 创建人
     */
    @Column(name = "created_by")
    private String createdBy;
    /**
     * 修改人
     */
    @Column(name = "changed_by")
    private String changedBy;
    /**
     * 修改时间
     */
    @Column(name = "changed_at")
    private Date changedAt;
    /**
     * 乐观锁
     */
    @Version
    @Column(name = "version")
    private Integer version;

}
